import axios from 'axios'


// var baseURL = 'https://www.ourspark.org/api'
var baseURL = 'http://localhost:8081/api'
// if(process.env.NODE_ENV === 'development') {
//     baseURL = 'http://localhost:8080/api'
// } else if(process.env.NODE_ENV === 'production'){
//     baseURL = 'https://www.ourspark.org/api'
// }

function paramsToString(params) {
    var url = '';
    for(var i in params) {
        url += i + '=' + params[i] + '&';
    }
    return url.slice(0, url.length-1)
}

export const modify_process = params => {
    // console.log(params)
    return axios({
        method: 'PUT',
        url: `${baseURL}/process/${params.id}`,
        data: params
    })
        .then(res => res.data)
}
export const delete_process = params => {
    // console.log(params)
    return axios({
        method: 'DELETE',
        url: `${baseURL}/process/${params.id}`,
        data: params
    })
        .then(res => res.data)
}
export const get_projectProcess = params => {
    // console.log(paramsToString(params))
    return axios({
        method: 'GET',
        url: `${baseURL}/process/?${paramsToString(params)}`,
        data: params
    })
        .then(res => res.data)
}
export const add_process = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/process/`,
        data: params
    })
        .then(res => res.data)
}
export const get_projectById = params => {
    // console.log(params)
    return axios({
        method: 'GET',
        url: `${baseURL}/project/${params.id}`,
        data: params
    })
        .then(res => res.data)
}
export const delete_project = params => {
    // console.log(params)
    return axios({
        method: 'DELETE',
        url: `${baseURL}/project/${params.id}`,
        data: params
    })
        .then(res => res.data)
}
export const modify_project = params => {
    // console.log(params)
    return axios({
        method: 'PUT',
        url: `${baseURL}/project/${params.id}`,
        data: params
    })
        .then(res => res.data)
}
export const get_all_projects = params => {
    // console.log(params)
    return axios({
        method: 'GET',
        url: `${baseURL}/project/get_all_projects`,
        data: params
    })
        .then(res => res.data)
}
export const add_project = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/project/`,
        data: params
    })
        .then(res => res.data)
}

export const studentListInDay = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/studentListInDay`,
        data: params
    })
        .then(res => res.data)
}
export const delete_note = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/delete_note`,
        data: params
    })
        .then(res => res.data)
}
export const bind_email = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/bind_email`,
        data: params
    })
        .then(res => res.data)
}
export const verify_signin = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/verify_signin`,
        data: params
    })
        .then(res => res.data)
}
export const add_logs = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/add_logs`,
        data: params
    })
        .then(res => res.data)
}
export const update_demo = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/update_demo`,
        data: params
    })
        .then(res => res.data)
}
export const get_demo = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/get_demo`,
        data: params
    })
        .then(res => res.data)
}
export const get_demos = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/get_demos`,
        data: params
    })
        .then(res => res.data)
}
export const add_demo = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/add_demo`,
        data: params
    })
        .then(res => res.data)
}
export const changeAvatar = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/changeAvatar`,
        data: params
    })
        .then(res => res.data)
}
export const get_index_homework = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/get_index_homework`,
        data: params
    })
        .then(res => res.data)
}
export const getCollectionFlags = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getCollectionFlags`,
        data: params
    })
        .then(res => res.data)
}
export const get_onePoint = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/get_onePoint`,
        data: params
    })
        .then(res => res.data)
}
export const getQuestionAnswer = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getQuestionAnswer`,
        data: params
    })
        .then(res => res.data)
}
export const getAllQuestions = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getAllQuestions`,
        data: params
    })
        .then(res => res.data)
}
export const like_and_cancel = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/like_and_cancel`,
        data: params
    })
        .then(res => res.data)
}
export const get_notes = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/get_notes`,
        data: params
    })
        .then(res => res.data)
}
export const add_note = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/add_note`,
        data: params
    })
        .then(res => res.data)
}
export const add_wordviewFlag = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/add_wordviewFlag`,
        data: params
    })
        .then(res => res.data)
}
export const get_wordviewFlag = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/get_wordviewFlag`,
        data: params
    })
        .then(res => res.data)
}
export const merge_audio = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/merge_audio`,
        data: params
    })
        .then(res => res.data)
}
export const save_audio = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/save_audio`,
        data: params
    })
        .then(res => res.data)
}
export const get_audio = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/get_audio`,
        data: params
    })
        .then(res => res.data)
}
export const del_codeCollection = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/del_codeCollection`,
        data: params
    })
        .then(res => res.data)
}
export const get_codeCollected = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/get_codeCollected`,
        data: params
    })
        .then(res => res.data)
}
export const get_allCodeCollection = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/get_allCodeCollection`,
        data: params
    })
        .then(res => res.data)
}
export const getQuesNumbyDay = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getQuesNumbyDay`,
        data: params
    })
        .then(res => res.data)
}
export const getWorkNumbyDay = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getWorkNumbyDay`,
        data: params
    })
        .then(res => res.data)
}
export const getLearnNumbyDay = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getLearnNumbyDay`,
        data: params
    })
        .then(res => res.data)
}
export const getCodeNumbyDay = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getCodeNumbyDay`,
        data: params
    })
        .then(res => res.data)
}
export const addDemoCode = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/addDemoCode`,
        data: params
    })
        .then(res => res.data)
}
export const getCode = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getCode`,
        data: params
    })
        .then(res => res.data)
}
export const getCodeList = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getCodeList`,
        data: params
    })
        .then(res => res.data)
}
export const updateLearnPath = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/updateLearnPath`,
        data: params
    })
        .then(res => res.data)
}
export const getCreateLearnPath = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getCreateLearnPath`,
        data: params
    })
        .then(res => res.data)
}
export const deleteLearnPath = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/deleteLearnPath`,
        data: params
    })
        .then(res => res.data)
}
export const getworkAnalysisExcel = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getworkAnalysisExcel`,
        data: params
    })
        .then(res => res.data)
}
export const getLearnPath = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getLearnPath`,
        data: params
    })
        .then(res => res.data)
}
export const add_learnpath = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/add_learnpath`,
        data: params
    })
        .then(res => res.data)
}
export const homeworkNot = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/homeworkNot`,
        data: params
    })
        .then(res => res.data)
}
export const workAnalysisTotal = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/workAnalysisTotal`,
        data: params
    })
        .then(res => res.data)
}
export const normalHomeworkHandeyet = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/normalHomeworkHandeyet`,
        data: params
    })
        .then(res => res.data)
}
export const getPointAllQuestion = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getPointAllQuestion`,
        data: params
    })
        .then(res => res.data)
}
export const refindPassword = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/refindPassword`,
        data: params
    })
        .then(res => res.data)
}
export const getSingleRecord = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getSingleRecord`,
        data: params
    })
        .then(res => res.data)
}
export const submit_comment = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/submit_comment`,
        data: params
    })
        .then(res => res.data)
}
export const addOnePosting = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/addOnePosting`,
        data: params
    })
        .then(res => res.data)
}
export const deletePosting = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/deletePosting`,
            data: params
        })
        .then(res => res.data)
}
export const getPostings = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getPostings`,
        data: params
    })
        .then(res => res.data)
}
export const getAllProcess = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getAllProcess`,
        data: params
    })
        .then(res => res.data)
}
export const getAllRecord = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getAllRecord`,
        data: params
    })
        .then(res => res.data)
}
export const getCollectedQuestionIs = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getCollectedQuestionIs`,
        data: params
    })
        .then(res => res.data)
}
export const getAllAssistantsWork = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getAllAssistantsWork`,
        data: params
    })
        .then(res => res.data)
}
export const getCollectedQuestion = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getCollectedQuestion`,
        data: params
    })
        .then(res => res.data)
}
export const getErroredQuestion = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getErroredQuestion`,
        data: params
    })
        .then(res => res.data)
}
export const next_problem = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/getOneQuestion`,
        data: params
    })
        .then(res => res.data)
}
export const collect_pro = params => {
    // console.log(params)
    return axios({
        method: 'POST',
        url: `${baseURL}/collectQuestion`,
        data: params
    })
        .then(res => res.data)
}

export const add_record = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/add_record`,
            data: params
        })
        .then(res => res.data)
}

export const findOneUser = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/findOneUser`,
            data: params
        })
        .then(res => res.data)
}

export const appoint = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/appoint`,
            data: params
        })
        .then(res => res.data)
}

export const getUnreadNumber = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getUnreadNumber`,
            data: params
        })
        .then(res => res.data)
}

export const hasRead = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/hasRead`,
            data: params
        })
        .then(res => res.data)
}

export const restoreTrash = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/restoreTrash`,
            data: params
        })
        .then(res => res.data)
}

export const removeReaded = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/removeReaded`,
            data: params
        })
        .then(res => res.data)
}

export const getMessage = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getMessage`,
            data: params
        })
        .then(res => res.data)
}

export const handleApply = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/handleApply`,
            data: params
        })
        .then(res => res.data)
}

export const getApply = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getApply`,
            data: params
        })
        .then(res => res.data)
}

export const addApply = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/addApply`,
            data: params
        })
        .then(res => res.data)
}

export const deleteQuestion = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/deleteQuestion`,
            data: params
        })
        .then(res => res.data)
}

export const modifyQuestion = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/modifyQuestion`,
            data: params
        })
        .then(res => res.data)
}

export const queryQuestion = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/queryQuestion`,
            data: params
        })
        .then(res => res.data)
}

export const addQuestion = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/addQuestion`,
            data: params
        })
        .then(res => res.data)
}

export const deletePoint = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/deletePoint`,
            data: params
        })
        .then(res => res.data)
}

export const modifyPoint = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/modifyPoint`,
            data: params
        })
        .then(res => res.data)
}

export const modifyMorePoints = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/modifyMorePoints`,
            data: params
        })
        .then(res => res.data)
}

export const savePoint = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/savePoint`,
            data: params
        })
        .then(res => res.data)
}

export const saveMorePoints = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/saveMorePoints`,
            data: params
        })
        .then(res => res.data)
}

export const requestLogin = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/loginUserPass`,
            data: params
        })
        .then(res => res.data)
}

export const requestSignin =  params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/supplyDetail`,
            data: params
        })
        .then(res => res.data)
}

export const checkUserDuplicate = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/duplicatUsername`,
            data: params
        })
        .then(res => res.data)
}

export const getIdent = params => {
    //console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getIdent`,
            data: params
        })
        .then(res => res.data)
}

export const signOut = params => {
    //console.log(params)
    return axios({
            method: 'POST', 
            url: `${baseURL}/logout`,
            data: params
        })
        .then(res => res.data)
}

export const getUserDetail = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getUserDetail`,
            data: params
        })
        .then(res => res.data)
}

export const modifyUserDetail = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/modifyUserDetail`,
            data: params
        })
        .then(res => res.data)
}

export const changePassword = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/changePassword`,
            data: params
        })
        .then(res => res.data)
}

export const getMenu = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getMenu`,
            data: params
        })
        .then(res => res.data)
}

export const getContent = params => {
    // console.log(params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getContent`,
            data: params
        })
        .then(res => res.data)
}

export const saveCodeRecord = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/saveCodeRecord`,
            data: params
        })
        .then(res => res.data)
}

export const addOneConnect = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/addOneConnect`,
            data: params
        })
        .then(res => res.data)
}

export const getAllFeedback = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getAllFeedback`,
            data: params
        })
        .then(res => res.data)
}

export const codingAnalysis = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/codingAnalysis`,
            data: params
        })
        .then(res => res.data)
}

export const getlearn_process = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getlearn_process`,
            data: params
        })
        .then(res => res.data)
}

export const add_PointProcess = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/add_PointProcess`,
            data: params
        })
        .then(res => res.data)
}

export const getLastCode = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getLastCode`,
            data: params
        })
        .then(res => res.data)
}

export const add_codeidea = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/add_codeidea`,
            data: params
        })
        .then(res => res.data)
}

export const add_customidea = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/add_customidea`,
            data: params
        })
        .then(res => res.data)
}

export const get_codeideaByFlag = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/get_codeideaByFlag`,
            data: params
        })
        .then(res => res.data)
}

export const get_customidea = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/get_customidea`,
            data: params
        })
        .then(res => res.data)
}

export const update_codeidea = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/update_codeidea`,
            data: params
        })
        .then(res => res.data)
}

export const get_codeideas = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/get_codeideas`,
            data: params
        })
        .then(res => res.data)
}

export const add_guide = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/add_guide`,
            data: params
        })
        .then(res => res.data)
}

export const add_codeCollection = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/add_codeCollection`,
            data: params
        })
        .then(res => res.data)
}

export const get_process = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/get_process`,
            data: params
        })
        .then(res => res.data)
}

export const addMessage = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/addMessage`,
            data: params
        })
        .then(res => res.data)
}

export const duplicatStuNo = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/duplicatStuNo`,
            data: params
        })
        .then(res => res.data)
}

export const getPointContent = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getPointContent`,
            data: params
        })
        .then(res => res.data)
}

export const addHomework = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/addHomework`,
            data: params
        })
        .then(res => res.data)
}

export const getHomework = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getHomework`,
            data: params
        })
        .then(res => res.data)
}

export const add_workRecord = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/add_workRecord`,
            data: params
        })
        .then(res => res.data)
}

export const workAnalysisPerson = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/workAnalysisPerson`,
            data: params
        })
        .then(res => res.data)
}

export const workDetail = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/workDetail`,
            data: params
        })
        .then(res => res.data)
}

export const getQuestionList = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getQuestionList`,
            data: params
        })
        .then(res => res.data)
}

export const getQandAlist = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getQandAlist`,
            data: params
        })
        .then(res => res.data)
}

export const getQuesPath = params => {
    //console.log('params', params)
    return axios({
            method: 'POST',
            url: `${baseURL}/getQuesPath`,
            data: params
        })
        .then(res => res.data)
}